<?php 
// Header

$this->set('title_for_layout', __("Tạo công năng mới", true));

$this->left_menu = 'menu/'.$this->params['controller'];
$params = array(
	//'root'	=>	$this->params['named']['root']
);

// -- Load CSS : End  --

// Load Javascript
echo $this->Html->script('ckeditor/ckeditor_basic');
//echo $this->Html->script('jquery.form');
echo $this->Html->script('/features/js/add');
?>
<style>
#dialogs {
	display:none;
}
    .list-table .file {margin-top: 0;}
</style>

<h2><?php __("Tạo công năng mới")?></h2>
<?php echo $session->flash()?>

<div class="buttons attop">
	<ul>
		<li><a href="<?php echo $html->url($params + array('action'	=>	'index'))?>" class="back"><?php __("Danh sách công năng")?></a></li>
		<li><a href="javascript:void(0)" class="save"><?php __("Thêm mới")?></a></li>
	</ul>
</div>

<?php 
echo $form->create('Feature', array(
	'url'	=>	
	$params + array(
		'controller'	=>	$this->params['controller'],	
		'action'		=>	'add'
	),
	'id'		=>	'add_page_form',
	'enctype'	=>	'multipart/form-data'
));
?>
<fieldset class="form">

<?php 
echo $form->input('title', array(
	'label'	=>	__("Tên: ", true),
	'error'	=>	__("Tên không được để trống", true),
	'size'	=> 50
));

if ($configs['Manage']['add']['show_alias']) {
	echo $form->input('alias', array('label'	=>	__("Alias: ", true)));
} else {
	echo $form->input('alias', array('label'	=>	__("Alias: ", true), 'type' => 'hidden'));
}

if ($configs['Feature']['image']['show']):
$options = array(
	//'name'				=>	$this->data['Article']['image'],
	'name'				=>	'',
	'path'				=>	'',
	'field_name'		=>	'image',
	'label'				=>	__('&nbsp;',true),
	'legend_title'		=>	__('Hình ảnh',true),
	'delete_image_link'	=>	''
);
echo $html->form_image($options,array());
endif;

if ($configs['Feature']['description']['show']):?>
<div class="input">
<table cellpadding='0' cellspacing='0' border='0' width='100%' class='list-table'>
<tr>
	<td class='label' valign='top'><label for="description"><?php __("Mô tả")?></label></td>
	<td>
		<?php
		echo $form->input('description', array('label'	=>	false, 'div'=>false, 'type'=>'textarea', 'value'	=>	$configs['Feature']['description']['default_content'])); 
		
		if (!isset($configs['Feature']['description']['use_rich_text']) || $configs['Feature']['description']['use_rich_text']):
		echo $wysiwyg->render("Feature.description", 'ckeditor', $configs['Feature']['description_config']);
		endif;
		
		?>
	</td>
</tr>
</table>
</div>
<?php endif;?>

<?php if ($configs['Feature']['content']['show']):?>
<div class="input">
<table cellpadding='0' cellspacing='0' border='0' width='100%' class='list-table'>
<tr>
	<td class='label' valign='top'><label for="content"><?php __("Nội dung: ")?></label></td>
	<td>
		<?php
		echo $form->input('content', array('label'	=>	false, 'div'=>false, 'type'=>'textarea', 'value' => $configs['Feature']['content']['default_content'])); 
		
		if (!isset($configs['Feature']['description']['use_rich_text']) || $configs['Feature']['description']['use_rich_text']):
		echo $wysiwyg->render("Feature.content", 'ckeditor', $configs['Feature']['content_config']);
		endif;
		?>
	</td>
</tr>
</table>
</div>
<?php endif;?>

<?php
echo $form->input('is_published', array('label' => __("Kích hoạt?", true), 'checked' => "checked"));
?>
<div style="display:none">
	<input type="submit"/>
</div>
</fieldset>
<?php echo $form->end();?>
<div class="buttons attop">
	<ul>
		<li><a href="<?php echo $html->url($params + array('action'	=>	'index'))?>" class="back"><?php __("Danh sách công năng")?></a></li>
		<li><a href="javascript:void(0)" class="save"><?php __("Thêm mới")?></a></li>
	</ul>
</div>